﻿using MediatR;
using S.EliminationOrDath.API.Application.Command.SheepDeathCommand;
using S.EliminationOrDath.Infrastructure.Interface;

namespace S.EliminationOrDath.API.Application.CommandHandlers.SheepDeathCommandHandler
{
    public class SheepDeathBatchRemoveCommandHandler : IRequestHandler<SheepDeathBatchRemoveCommand, bool>
    {
        private readonly ISheepDeathRepository _sheepDeathRepository;
        public SheepDeathBatchRemoveCommandHandler(ISheepDeathRepository sheepDeathRepository)
        {
            _sheepDeathRepository= sheepDeathRepository;
        }
        /// <summary>
        /// 根据ids对羊只死亡进行批量删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<bool> Handle(SheepDeathBatchRemoveCommand request, CancellationToken cancellationToken)
        {
            return await _sheepDeathRepository.BacthDelete(request.ids);
        }
    }
}
